Example #1
0
def test_user_content():
    with mock_session_with_fixtures(client.session, "tests/fixtures", TEST_URL):
        response = client.content.starts_and_completions()
        assert response[0].id == "f41f88d2-c9f0-4f5d-9dcc-c3c6c33d7e6d"
        assert response[0].content.name == "PathGather first 5 minutes"
        assert response[0].content.provider.name == "youtu.be"
        assert response[0].user.first_name == "non"
Example #2
0
def test_all_paths():
    with mock_session_with_fixtures(client.session, "tests/fixtures",
                                    TEST_URL):
        response = client.paths.all()
        assert response[0].id == TEST_PATH_ID
        assert response[0].user.first_name == "Anthony"
        assert response[0].skills[0].name == "Learning and Development"
Example #3
0
def test_get_all_gatherings():
    with mock_session_with_fixtures(client.session, "tests/fixtures",
                                    TEST_URL):
        response = client.gatherings.all()
        assert response[0].id == "3578d16a-381a-4041-a6bb-1b3957fc8e94"
        assert response[0].name == "Learn to Code"
        assert response[0].user.first_name == "Anthony"
Example #4
0
def test_all_users():
    with mock_session_with_fixtures(client.session, "tests/fixtures",
                                    TEST_URL):
        response = client.users.all()
        assert response[0].id == TEST_USER_ID
        assert response[
            0].department.id == "90c8e4f2-3fba-4747-9322-00635bcff1bc"
Example #5
0
def test_get_path_completions():
    with mock_session_with_fixtures(client.session, "tests/fixtures",
                                    TEST_URL):
        response = client.paths.starts_and_completions()
        assert response[0].id == "e3904e76-2405-4a69-8e6e-40f9ac4674c7"
        assert response[0].path.user.first_name == "Test"
        assert response[0].user.last_name == u"Morley ⓨ"
        assert response[0].path.name == "Pathgather for L&D Managers"
def test_context_manager():
    new_session = Session()
    with mock_session_with_fixtures(new_session, 'tests/fixtures',
                                    'http://test_context.com'):
        response = new_session.request('get',
                                       'http://test_context.com/test.txt')
        assert response.text == 'Hello world!'
    # assert resets back to default 2 adapters
    assert len(new_session.adapters) == 2
Example #7
0
def test_all_providers():
    with mock_session_with_fixtures(client.session, "tests/fixtures", TEST_URL):
        response = client.providers.all()
        assert response[5].id == "fd0bcc42-05ff-443e-9c13-523025bad80a"
        assert response[5].name == "Talk Python to Me Podcast"
        assert response[5].custom_id == "talk_python_podcast"
        assert response[5].created_at.timestamp == 1512682775
        assert response[5].created_at == response[5].updated_at
        assert not response[5].may_require_vpn
        assert not response[5].may_not_be_mobile_friendly
        assert response[5].is_subscribed
Example #8
0
def test_get_all_content_filter():
    with mock_session_with_fixtures(client.session, "tests/fixtures", TEST_URL):
        response = client.content.all(filter="shared")
        assert response[0].id == TEST_CONTENT_ID
        assert response[0].name == "ADO.NET Fundamentals"
Example #9
0
def test_get_all_content_query():
    with mock_session_with_fixtures(client.session, "tests/fixtures", TEST_URL):
        response = client.content.all(query={"a": 1})
        assert response[0].id == TEST_CONTENT_ID
        assert response[0].name == "ADO.NET Fundamentals"
Example #10
0
def test_all_skills():
    with mock_session_with_fixtures(client.session, "tests/fixtures",
                                    TEST_URL):
        response = client.skills.all()
        assert response[0].id == "5b122717-6b68-4614-889c-be1b15391891"
        assert response[0].name == "data science"