Ejemplo n.º 1
0
    def test_user_with_logged_in(self, m_get, m_post):
        """ Users should get user's info with sending token."""
        from qiita.users import Users
        dummy_response(m_post, 'data/auth.json')
        client = Users(**settings())

        dummy_response(m_get, 'data/user_info.json')
        result = client.user(self.params['url_name'])
        self.assertTrue('url_name' in result)
        self.assertTrue('name' in result)
Ejemplo n.º 2
0
    def test_user_with_logged_in(self, m_get, m_post):
        """ Users should get user's info with sending token."""
        from qiita.users import Users
        dummy_response(m_post, 'data/auth.json')
        client = Users(**settings())

        dummy_response(m_get, 'data/user_info.json')
        result = client.user(self.params['url_name'])
        self.assertTrue('url_name' in result)
        self.assertTrue('name' in result)
Ejemplo n.º 3
0
 def test_shortcut(self):
     """ qiita should import Client, Items, Tags, Users. """
     from qiita import Client, Items, Tags, Users
     self.assertTrue(isinstance(Client(), Client))
     self.assertTrue(isinstance(Items(), Items))
     self.assertTrue(isinstance(Tags(), Tags))
     self.assertTrue(isinstance(Users(), Users))
Ejemplo n.º 4
0
 def setUp(self):
     from qiita.users import Users
     self.params = settings()
     self.users = Users()
Ejemplo n.º 5
0
class TestUsers(TestCase):
    def setUp(self):
        from qiita.users import Users
        self.params = settings()
        self.users = Users()

    @patch('qiita.client.requests.get')
    def test_public_user_items(self, m):
        """ Users should return public items. """
        dummy_response(m, 'data/public_user_items.json')
        result = self.users.user_items()
        self.assertTrue(isinstance(result, list))

    @patch('qiita.client.requests.get')
    def test_user_items(self, m):
        """ Users should return user's items. """
        dummy_response(m, 'data/user_items.json')
        result = self.users.user_items(self.params['url_name'])
        self.assertTrue(isinstance(result, list))

    @patch('qiita.client.requests.get')
    def test_user(self, m):
        """ Users should get user info. """
        dummy_response(m, 'data/user_info.json')
        result = self.users.user(self.params['url_name'])
        self.assertTrue('url_name' in result)
        self.assertTrue('name' in result)

    @patch('qiita.client.requests.get')
    def test_following_tags(self, m):
        """ Users should get following tags. """
        dummy_response(m, 'data/user_following_tags.json')
        result = self.users.user_following_tags(self.params['url_name'])
        self.assertTrue('name' in result[0])
        self.assertTrue('url_name' in result[0])

    @patch('qiita.client.requests.get')
    def test_user_following_users(self, m):
        """ Users should get following users. """
        dummy_response(m, 'data/following_users.json')
        result = self.users.user_following_users(self.params['url_name'])
        self.assertTrue('name' in result[0])
        self.assertTrue('url_name' in result[0])

    @patch('qiita.client.requests.get')
    def test_user_stocks(self, m):
        """ Users should get stock. """
        dummy_response(m, 'data/user_stock.json')
        result = self.users.user_stocks(self.params['url_name'])
        self.assertTrue('body' in result[0])

    @patch('qiita.client.requests.post')
    @patch('qiita.client.requests.get')
    def test_user_with_logged_in(self, m_get, m_post):
        """ Users should get user's info with sending token."""
        from qiita.users import Users
        dummy_response(m_post, 'data/auth.json')
        client = Users(**settings())

        dummy_response(m_get, 'data/user_info.json')
        result = client.user(self.params['url_name'])
        self.assertTrue('url_name' in result)
        self.assertTrue('name' in result)
Ejemplo n.º 6
0
 def setUp(self):
     from qiita.users import Users
     self.params = settings()
     self.users = Users()
Ejemplo n.º 7
0
class TestUsers(TestCase):
    def setUp(self):
        from qiita.users import Users
        self.params = settings()
        self.users = Users()

    @patch('qiita.client.requests.get')
    def test_public_user_items(self, m):
        """ Users should return public items. """
        dummy_response(m, 'data/public_user_items.json')
        result = self.users.user_items()
        self.assertTrue(isinstance(result, list))

    @patch('qiita.client.requests.get')
    def test_user_items(self, m):
        """ Users should return user's items. """
        dummy_response(m, 'data/user_items.json')
        result = self.users.user_items(self.params['url_name'])
        self.assertTrue(isinstance(result, list))

    @patch('qiita.client.requests.get')
    def test_user(self, m):
        """ Users should get user info. """
        dummy_response(m, 'data/user_info.json')
        result = self.users.user(self.params['url_name'])
        self.assertTrue('url_name' in result)
        self.assertTrue('name' in result)

    @patch('qiita.client.requests.get')
    def test_following_tags(self, m):
        """ Users should get following tags. """
        dummy_response(m, 'data/user_following_tags.json')
        result = self.users.user_following_tags(self.params['url_name'])
        self.assertTrue('name' in result[0])
        self.assertTrue('url_name' in result[0])

    @patch('qiita.client.requests.get')
    def test_user_following_users(self, m):
        """ Users should get following users. """
        dummy_response(m, 'data/following_users.json')
        result = self.users.user_following_users(self.params['url_name'])
        self.assertTrue('name' in result[0])
        self.assertTrue('url_name' in result[0])

    @patch('qiita.client.requests.get')
    def test_user_stocks(self, m):
        """ Users should get stock. """
        dummy_response(m, 'data/user_stock.json')
        result = self.users.user_stocks(self.params['url_name'])
        self.assertTrue('body' in result[0])

    @patch('qiita.client.requests.post')
    @patch('qiita.client.requests.get')
    def test_user_with_logged_in(self, m_get, m_post):
        """ Users should get user's info with sending token."""
        from qiita.users import Users
        dummy_response(m_post, 'data/auth.json')
        client = Users(**settings())

        dummy_response(m_get, 'data/user_info.json')
        result = client.user(self.params['url_name'])
        self.assertTrue('url_name' in result)
        self.assertTrue('name' in result)