ssossossosso

Forums

Covering OroCRM topics, including community updates and company announcements.  Subscribe

This topic contains 42 replies, has 4 voices, and was last updated by  archy_bold 11 months, 3 weeks ago.

  • Creator
    Topic
  • #8362

    jakabadambalazs
    Participant

    Hi,

    I followed your guide about setting up the test environment and writting functional tests. I am stuck on my very first testIndex action because I get 401 (authentication failure) where I am expecting 200.

    I did:

    configured config_test.yml

    I see my db populated and user exists with username “admin”

    and this my my test:

    … and this is what i get:

    🙁

    I even tried without luck:

    Where do you think I made a mistake out something?


    oro/platform(1.6.2) + oro/doctrine-extensions(1.0.7) + symfony/symfony(v2.3.27)

Viewing 15 replies - 1 through 15 (of 42 total)
  • Author
    Replies
  • #8365

    jakabadambalazs
    Participant

    actually, looking over response codes I do not get 403(auth error) but 401(unauthorized) – so I am actually a step before it – I dumped my request and response headers:

    REQUEST:
    host = [“localhost”]
    user-agent = [“Symfony2 BrowserKit”]
    accept = [“text\/html,application\/xhtml+xml,application\/xml;q=0.9,*\/*;q=0.8”]
    accept-language = [“en-us,en;q=0.5”]
    accept-charset = [“ISO-8859-1,utf-8;q=0.7,*;q=0.7”]
    x-csrf-header = [1]
    php-auth-user = [“admin”]
    php-auth-pw = [“admin”]
    authorization = [“Basic YWRtaW46YWRtaW4=”]
    x-php-ob-level = [1]

    RESULT(401):
    cache-control = [“no-cache”]
    date = [“Thu, 05 Feb 2015 09:32:29 GMT”]
    www-authenticate = [“Basic realm=\”Secured REST Area\””]
    content-type = [“text\/html; charset=UTF-8”]

    any ideas?


    oro/platform(1.6.2) + oro/doctrine-extensions(1.0.7) + symfony/symfony(v2.3.27)

    #8366
    Yevhen Shyshkin
    Yevhen Shyshkin
    Oro Core

    Hello.

    Look’s like installation and code itself is fine, you can even remove ‘HTTP_X-CSRF-Header’ header because generateBasicAuthHeader will generate valid header data. Also command “oro:test:schema:update” now executing during installation in test environment, so don’t need to run it manually.

    You can check your environment by running one of platform tests to verify that installation is correct.

    We’ve faced this issue when test user from fixture was not downloaded. Please, check that user was uploaded:

    As a result where must be user with API key in your DB.

    #8367

    jakabadambalazs
    Participant

    I have all tests failing for Oro\Bundle\UserBundle\Tests\Functional\ControllersTest
    always returning 401

    I have loaded the fixture Oro\Bundle\TestFrameworkBundle\Fixtures\LoadUserData

    I have user with api key in db (i did have it before as well though) and
    still 401

    any other ideas?

    thanks
    a\


    oro/platform(1.6.2) + oro/doctrine-extensions(1.0.7) + symfony/symfony(v2.3.27)

    #8369
    Yevhen Shyshkin
    Yevhen Shyshkin
    Oro Core

    Then you should debug authentification and check which provider and why restrict access.

    #8370
    Yevhen Shyshkin
    Yevhen Shyshkin
    Oro Core

    > php-auth-user = [“admin”]
    It should be “admin@example.com”.

    #8371

    jakabadambalazs
    Participant

    how come? isn’t that username? i have user in db with username: admin and email:admin@example.com

    now i init my client like this:

    I have removed ‘HTTP_X-CSRF-Header’ and headers are now:

    REQUEST:
    host = [“localhost”]
    user-agent = [“Symfony2 BrowserKit”]
    accept = [“text\/html,application\/xhtml+xml,application\/xml;q=0.9,*\/*;q=0.8”]
    accept-language = [“en-us,en;q=0.5”]
    accept-charset = [“ISO-8859-1,utf-8;q=0.7,*;q=0.7”]
    php-auth-user = [“admin@example.com”]
    php-auth-pw = [“admin”]
    authorization = [“Basic YWRtaW5AZXhhbXBsZS5jb206YWRtaW4=”]
    x-php-ob-level = [1]

    RESULT(401):
    cache-control = [“no-cache”]
    date = [“Thu, 05 Feb 2015 10:44:30 GMT”]
    www-authenticate = [“Basic realm=\”Secured REST Area\””]
    content-type = [“text\/html; charset=UTF-8”]

    key php-auth-user is now correct but i am still getting 401

    this is my config_test.yml:

    and this is my security_test.yml:

    they are both unmodified as they were in the platfom application.

    I did a fresh install – all installs fine but still 401

    when you say

    Then you should debug authentification and check which provider and why restrict access.

    where should i start?


    oro/platform(1.6.2) + oro/doctrine-extensions(1.0.7) + symfony/symfony(v2.3.27)

    #8372

    jakabadambalazs
    Participant

    shouldn’t

    http-basic: false

    be

    http-basic: true

    in security_test.yml?


    oro/platform(1.6.2) + oro/doctrine-extensions(1.0.7) + symfony/symfony(v2.3.27)

    #8373
    Yevhen Shyshkin
    Yevhen Shyshkin
    Oro Core

    No, your security_test.yml is fine – at least on my env it works.

    > where should i start?
    I’d start from UnauthorizedHttpException::__construct to get full stack trace where this exception is coming from.

    #8375

    jakabadambalazs
    Participant

    hmmm, i do NOT reach UnauthorizedHttpException class –

    I inserted in the constructor:

    but it never gets called!

    …i’ll try to read some sf2 documentations…


    oro/platform(1.6.2) + oro/doctrine-extensions(1.0.7) + symfony/symfony(v2.3.27)

    #8376
    Yevhen Shyshkin
    Yevhen Shyshkin
    Oro Core

    That’s odd. Symfony may return 401 from FormAuthenticationEntryPoint, DigestAuthenticationEntryPoint and FormAuthenticationEntryPoint (you can find all these files by “401” string) – maybe it’s one of these.

    #8377

    jakabadambalazs
    Participant

    yes, odd indeed! Thanks! I found the entry point giving me 401. It is BasicAuthenticationEntryPoint.

    and I have a backtrace:

    There was 1 error:

    it is complaining about Oro\Bundle\UserBundle\Entity\User::$avatar
    does this make sense to you?


    oro/platform(1.6.2) + oro/doctrine-extensions(1.0.7) + symfony/symfony(v2.3.27)

    #8379
    Yevhen Shyshkin
    Yevhen Shyshkin
    Oro Core

    Could you drop your test DB, remove cache and do install on clear DB? Probably you have outdated metadata somewhere.

    #8380

    jakabadambalazs
    Participant

    ok, here we go:

    at this point I should be all set, however if I do:

    I get:

    I don’t think it has anything to do with my problem but it is strange these were not created during install.

    for now I do not force it.

    so, let’s phpunit…..(fingers crossed)…

    NOPE: here is backtrace:


    oro/platform(1.6.2) + oro/doctrine-extensions(1.0.7) + symfony/symfony(v2.3.27)

    #8381
    Yevhen Shyshkin
    Yevhen Shyshkin
    Oro Core

    > I don’t think it has anything to do with my problem but it is strange these were not created during install.
    Thank you, it’s known issue.

    Look’s like some either DB, or cache issue, because error happens during UserManager->findUserByEmail.

    Could you do install in test env on clear DB (without any dirty data)? I.e. “DROP DATABASE” and “CREATE DATABASE” instead of “doctrine:schema:drop”.

    Also it would be great if you’ll be able to find out where null object come from error “Call to a member function setValue() on a non-object”.

    #8382

    jakabadambalazs
    Participant

    i have also tested that “app/cache/test/oro_entities/Extend/Entity/EX_OroUserBundle_User.php” gets loaded and it does and it has:

    which seems correct to me

    I am not sure why the corresponding does not mention the avatar property in “app/cache/test/oro_entities/Extend/Entity/EX_OroUserBundle_User.orm.yml”


    oro/platform(1.6.2) + oro/doctrine-extensions(1.0.7) + symfony/symfony(v2.3.27)

Viewing 15 replies - 1 through 15 (of 42 total)

You must be logged in to reply to this topic.