def test_pushes_user_filter(self):
     self.insert_pushes()
     pushes, pushes_count = self.api_call("pushes?user=troscoe")
     T.assert_length(pushes, 1)
     T.assert_equal(pushes_count, 1)
     for push in pushes:
         T.assert_equal(push["user"], "troscoe")
 def test_pushes_state_filter(self):
     self.insert_pushes()
     pushes, pushes_count = self.api_call("pushes?state=live")
     T.assert_length(pushes, 1)
     T.assert_equal(pushes_count, 1)
     for push in pushes:
         T.assert_equal(push['state'], 'live')
Beispiel #3
0
 def test_call(self):
     """Just call a turtle"""
     ret = self.leonardo()
     assert ret
     T.assert_length(self.leonardo.returns, 1)
     T.assert_call(self.leonardo, 0)
     T.assert_equal(ret, self.leonardo.returns[0])
Beispiel #4
0
    def test_imported_things_are_ignored(self):
        #TODO CHANGE MY NAME
        discovered_imported = list(test_discovery.discover('test.test_suite_subdir.import_testcase'))
        discovered_actually_defined_in_module = list(test_discovery.discover('test.test_suite_subdir.define_testcase'))

        assert_length(discovered_imported, 0)
        assert_length(discovered_actually_defined_in_module, 1)
 def test_pushes_user_filter(self):
     self.insert_pushes()
     pushes, pushes_count = self.api_call("pushes?user=troscoe")
     T.assert_length(pushes, 1)
     T.assert_equal(pushes_count, 1)
     for push in pushes:
         T.assert_equal(push['user'], 'troscoe')
 def test_pushes_state_filter(self):
     self.insert_pushes()
     pushes, pushes_count = self.api_call("pushes?state=live")
     T.assert_length(pushes, 1)
     T.assert_equal(pushes_count, 1)
     for push in pushes:
         T.assert_equal(push["state"], "live")
Beispiel #7
0
 def test_call_record(self):
     """Check that calls are recorded"""
     self.leonardo(1, 2, 3, quatro=4)
     T.assert_length(self.leonardo.calls, 1)
     T.assert_call(self.leonardo, 0, 1, 2, 3, quatro=4)
     self.leonardo(5, six=6)
     T.assert_call(self.leonardo, 1, 5, six=6)
    def test_pushes_filters(self):
        self.insert_pushes()
        pushes, pushes_count = self.api_call("pushes?user=heyjoe&state=accepting")
        T.assert_length(pushes, 1)
        T.assert_equal(pushes_count, 1)
        for push in pushes:
            T.assert_equal(push["user"], "heyjoe")
            T.assert_equal(push["state"], "accepting")

        pushes, pushes_count = self.api_call("pushes?user=heyjoe&state=live")
        T.assert_length(pushes, 0)
        T.assert_equal(pushes_count, 0)
    def test_pushes_order(self):
        self.insert_pushes()
        pushes, _ = self.api_call("pushes")
        T.assert_length(pushes, 6)

        lastpush = None
        for push in pushes:
            if lastpush is not None:
                if push["state"] == "accepting":
                    T.assert_equal("accepting", lastpush["state"])
                elif lastpush["state"] != "accepting":
                    T.assert_gte(push["modified"], lastpush["modified"])
            lastpush = push
Beispiel #10
0
    def test_pushes_order(self):
        self.insert_pushes()
        pushes, _ = self.api_call("pushes")
        T.assert_length(pushes, 6)

        lastpush = None
        for push in pushes:
            if lastpush is not None:
                if push['state'] == 'accepting':
                    T.assert_equal('accepting', lastpush['state'])
                elif lastpush['state'] != 'accepting':
                    T.assert_gte(push['modified'], lastpush['modified'])
            lastpush = push
    def test_pushes_order(self):
        self.insert_pushes()
        pushes, _ = self.api_call("pushes")
        T.assert_length(pushes, 6)

        lastpush = None
        for push in pushes:
            if lastpush is not None:
                if push['state'] == 'accepting':
                    T.assert_equal('accepting', lastpush['state'])
                elif lastpush['state'] != 'accepting':
                    T.assert_gte(push['modified'], lastpush['modified'])
            lastpush = push
    def test_pushes_filters(self):
        self.insert_pushes()
        pushes, pushes_count = self.api_call(
            "pushes?user=heyjoe&state=accepting")
        T.assert_length(pushes, 1)
        T.assert_equal(pushes_count, 1)
        for push in pushes:
            T.assert_equal(push['user'], 'heyjoe')
            T.assert_equal(push['state'], 'accepting')

        pushes, pushes_count = self.api_call("pushes?user=heyjoe&state=live")
        T.assert_length(pushes, 0)
        T.assert_equal(pushes_count, 0)
Beispiel #13
0
 def test_connect_flow(self):
     sockets = []
     def add_socket(*args):
         retval = mock.Mock()
         sockets.append(retval)
         return retval
     mock_getaddrinfo = mock.Mock(return_value=[self.addrinfo_one, self.addrinfo_four])
     mock_socket = mock.Mock(side_effect=add_socket)
     mock_read_iv = mock.Mock(return_value=(self.sigil_one, self.sigil_two))
     with mock.patch('socket.getaddrinfo', mock_getaddrinfo):
         with mock.patch('socket.socket', mock_socket):
             with mock.patch.object(self.sender, '_read_init_packet', mock_read_iv):
                 self.sender.connect()
     mock_socket.assert_any_call(socket.AF_INET, socket.SOCK_STREAM, socket.SOL_TCP)
     mock_socket.assert_any_call(socket.AF_INET, socket.SOCK_STREAM, socket.SOL_UDP)
     assert_length(sockets, 2)
     mock_read_iv.assert_any_call(sockets[0])
     mock_read_iv.assert_any_call(sockets[1])
    def test_pushes(self):
        pushes, last_push = self.api_call("pushes")
        T.assert_length(pushes, 2)
        T.assert_equal(last_push, 2)

        pushes, last_push = self.api_call("pushes?rpp=1")
        T.assert_length(pushes, 1)

        pushes, last_push = self.api_call("pushes?before=%d" % time.time())
        T.assert_length(pushes, 2)
Beispiel #15
0
    def test_pushes(self):
        pushes, last_push = self.api_call("pushes")
        T.assert_length(pushes, 2)
        T.assert_equal(last_push, 2)

        pushes, last_push = self.api_call("pushes?rpp=1")
        T.assert_length(pushes, 1)

        pushes, last_push = self.api_call("pushes?before=%d" % time.time())
        T.assert_length(pushes, 2)
    def test_pushes(self):
        pushes, pushes_count = self.api_call("pushes")
        T.assert_length(pushes, 2)
        T.assert_equal(pushes_count, 2)

        pushes, pushes_count = self.api_call("pushes?rpp=1")
        T.assert_length(pushes, 1)
        T.assert_equal(pushes_count, 2)

        pushes, pushes_count = self.api_call("pushes?offset=1")
        T.assert_length(pushes, 1)
        T.assert_equal(pushes_count, 2)
    def test_pushes(self):
        pushes, pushes_count = self.api_call("pushes")
        T.assert_length(pushes, 2)
        T.assert_equal(pushes_count, 2)

        pushes, pushes_count = self.api_call("pushes?rpp=1")
        T.assert_length(pushes, 1)
        T.assert_equal(pushes_count, 2)

        pushes, pushes_count = self.api_call("pushes?offset=1")
        T.assert_length(pushes, 1)
        T.assert_equal(pushes_count, 2)
 def test_pushdata(self):
     push_info, contents, requests = self.api_call("pushdata?id=1")
     T.assert_equal(push_info['title'], "Test Push")
     T.assert_length(contents, 2)
     T.assert_equal(requests[0]['state'], "requested")
 def test_requestsearch_when_user_and_repo_are_different(self):
     requests = self.api_call("requestsearch?user=otheruser&repo=testuser&branch=testuser_important_fixes")
     T.assert_length(requests, 1)
    def test_len_with_ancestor(self):
        cd = ChainedDict(**{"the_key": True})
        cd2 = ChainedDict(parent=cd, **{"the_other_key": True})

        T.assert_length(cd2, 2)
Beispiel #21
0
 def test_index_internal_exposes_jar_list(self):
     with self.client.patch_ip('127.0.0.1'):
         response = self.client.get(flask.url_for('index'))
         assert_no_response_errors(response)
         T.assert_length(response.pq.find(self._get_jar_list_selector()), 1)
Beispiel #22
0
 def test_index_external_does_not_expose_jar_list(self):
     response = self.client.get(flask.url_for('index'))
     assert_no_response_errors(response)
     T.assert_length(response.pq.find(self._get_jar_list_selector()), 0)
Beispiel #23
0
 def test_really_random(self):
     bytez = random_util.really_random_bytes(self.BYTES)
     T.assert_length(bytez, self.BYTES)
Beispiel #24
0
 def test_pushitems(self):
     pushitems = self.api_call("pushitems?push_id=1")
     T.assert_length(pushitems, 0)
Beispiel #25
0
 def test_pushcontents(self):
     pushcontents = self.api_call("pushcontents?id=1")
     T.assert_length(pushcontents, 1)
     T.assert_equal(pushcontents[0]['state'], 'pickme')
Beispiel #26
0
 def test_sort_of_random(self):
     bytez = random_util.sort_of_random_bytes(self.BYTES)
     T.assert_length(bytez, self.BYTES)
Beispiel #27
0
 def test_pushdata(self):
     push_info, contents, requests = self.api_call("pushdata?id=1")
     T.assert_equal(push_info['title'], "Test Push")
     T.assert_length(contents, 2)
     T.assert_equal(requests[0]['state'], "requested")
 def test_pushitems(self):
     pushitems = self.api_call("pushitems?push_id=1")
     T.assert_length(pushitems, 0)
    def test_len(self):
        cd = ChainedDict(**{"the_key": True})

        T.assert_length(cd, 1)
 def test_pushcontents(self):
     pushcontents = self.api_call("pushcontents?id=1")
     T.assert_length(pushcontents, 1)
     T.assert_equal(pushcontents[0]['state'], 'pickme')
Beispiel #31
0
    def test_requestsearch(self):
        requests = self.api_call("requestsearch?mbefore=%d" % time.time())
        T.assert_length(requests, 3)

        requests = self.api_call("requestsearch?cbefore=%d" % time.time())
        T.assert_length(requests, 3)

        requests = self.api_call("requestsearch?state=requested")
        T.assert_length(requests, 2)

        requests = self.api_call("requestsearch?state=pickme")
        T.assert_length(requests, 1)

        requests = self.api_call("requestsearch?user=bmetin")
        T.assert_length(requests, 2)

        requests = self.api_call("requestsearch?repo=bmetin")
        T.assert_length(requests, 2)

        requests = self.api_call("requestsearch?branch=bmetin_fix_stuff")
        T.assert_length(requests, 1)

        requests = self.api_call("requestsearch?title=fix")
        T.assert_length(requests, 2)

        requests = self.api_call("requestsearch?title=fix&limit=1")
        T.assert_length(requests, 1)
    def test_requestsearch(self):
        requests = self.api_call("requestsearch?mbefore=%d" % time.time())
        T.assert_length(requests, 3)

        requests = self.api_call("requestsearch?cbefore=%d" % time.time())
        T.assert_length(requests, 3)

        requests = self.api_call("requestsearch?state=requested")
        T.assert_length(requests, 2)

        requests = self.api_call("requestsearch?state=pickme")
        T.assert_length(requests, 1)

        requests = self.api_call("requestsearch?user=bmetin")
        T.assert_length(requests, 2)

        requests = self.api_call("requestsearch?repo=bmetin")
        T.assert_length(requests, 2)

        requests = self.api_call("requestsearch?branch=bmetin_fix_stuff")
        T.assert_length(requests, 1)

        requests = self.api_call("requestsearch?title=fix")
        T.assert_length(requests, 2)

        requests = self.api_call("requestsearch?title=fix&limit=1")
        T.assert_length(requests, 1)
Beispiel #33
0
 def test_requestsearch_when_user_and_repo_are_different(self):
     requests = self.api_call(
         "requestsearch?user=otheruser&repo=testuser&branch=testuser_important_fixes"
     )
     T.assert_length(requests, 1)