<commit_before># This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

import pytest

from pages.home import HomePage


class TestAvailableTasks():

    @pytest.mark.nondestructive
    def test_assigned_task_is_not_available(self, base_url, selenium, assigned_task, new_user):
        home_page = HomePage(selenium, base_url).open()
        home_page.login(new_user)
        available_tasks_page = home_page.click_available_tasks()
        home_page.search_for_task(assigned_task['task'].name)
        assert len(available_tasks_page.available_tasks) == 0
        from nose.tools import eq_
        eq_(assigned_task['task'].is_available_to_user(assigned_task['user']), True)

    @pytest.mark.nondestructive
    def test_that_unassigned_task_is_available(self, base_url, selenium, task, new_user):
        home_page = HomePage(selenium, base_url).open()
        home_page.login(new_user)
        available_tasks_page = home_page.click_available_tasks()
        home_page.search_for_task(task.name)
        assert len(available_tasks_page.available_tasks)<commit_msg>Replaced _eq<commit_after># This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

import pytest

from pages.home import HomePage


class TestAvailableTasks():

    @pytest.mark.nondestructive
    def test_assigned_task_is_not_available(self, base_url, selenium, assigned_task, new_user):
        home_page = HomePage(selenium, base_url).open()
        home_page.login(new_user)
        available_tasks_page = home_page.click_available_tasks()
        home_page.search_for_task(assigned_task['task'].name)
        assert len(available_tasks_page.available_tasks) == 0
        assert assigned_task['task'].is_available_to_user(assigned_task['user']) == True

    @pytest.mark.nondestructive
    def test_that_unassigned_task_is_available(self, base_url, selenium, task, new_user):
        home_page = HomePage(selenium, base_url).open()
        home_page.login(new_user)
        available_tasks_page = home_page.click_available_tasks()
        home_page.search_for_task(task.name)
        assert len(available_tasks_page.available_tasks)
{'fraction_non_alphanumeric': 0.0887029288702929, 'fraction_numerical': 0.0041841004184100415, 'mean_word_length': 4.16414686825054, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '977715', 'n_tokens_mistral': 777, 'n_tokens_neox': 752, 'n_words': 161}