Exemple #1
0
def not_upg_check(response):
    """
    Check that the user was not assigned to the corresponding
    private group.
    """

    assert_not_equal(response['result']['uidnumber'],
                     response['result']['gidnumber'])
    return True
Exemple #2
0
def not_upg_check(response):
    """
    Check that the user was not assigned to the corresponding
    private group.
    """

    assert_not_equal(response['result']['uidnumber'],
                     response['result']['gidnumber'])
    return True
Exemple #3
0
 def test_i18n_consequence_receive(self):
     """
     Test if consequence translations requests for different languages are
     successful. Every request's result have to contain messages in it's
     locale.
     """
     prev_i18n_msgs = self._fetch_i18n_msgs_http('en-us')
     cur_i18n_msgs = self._fetch_i18n_msgs_http('fr-fr')
     try:
         assert_equal(prev_i18n_msgs['texts']['true'], u'True')
         assert_equal(cur_i18n_msgs['texts']['true'], u'Vrai')
     except KeyError:
         assert_not_equal(prev_i18n_msgs, cur_i18n_msgs)
Exemple #4
0
    def test_jsplugins(self):
        empty_response = "define([],function(){return[];});"

        # Step 1: make sure default response has no additional plugins
        response = self.send_request(method='GET')
        assert_equal(response.status, 200)
        response_data = response.read().decode(encoding='utf-8')
        assert_equal(response_data, empty_response)

        # Step 2: add fake plugins
        try:
            for (d, f) in self.jsplugins:
                dir = os.path.join(paths.IPA_JS_PLUGINS_DIR, d)
                if not os.path.exists(dir):
                    os.mkdir(dir, 0o755)
                if f:
                    with open(os.path.join(dir, f), 'w') as js:
                        js.write("/* test js plugin */")

        except OSError as e:
            pytest.skip('Cannot set up test JS plugin: %s' % e)

        # Step 3: query plugins to see if our plugins exist
        response = self.send_request(method='GET')
        assert_equal(response.status, 200)
        response_data = response.read().decode(encoding='utf-8')
        assert_not_equal(response_data, empty_response)
        for (d, f) in self.jsplugins:
            if f:
                assert "'" + d + "'" in response_data
            else:
                assert "'" + d + "'" not in response_data

        # Step 4: remove fake plugins
        try:
            for (d, f) in self.jsplugins:
                dir = os.path.join(paths.IPA_JS_PLUGINS_DIR, d)
                file = os.path.join(dir, f)
                if f and os.path.exists(file):
                    os.unlink(file)
                if os.path.exists(dir):
                    os.rmdir(dir)
        except OSError:
            pass

        # Step 5: make sure default response has no additional plugins
        response = self.send_request(method='GET')
        assert_equal(response.status, 200)
        response_data = response.read().decode(encoding='utf-8')
        assert_equal(response_data, empty_response)