Example #1
0
    def test_build_md5(self, m_binit):
        from pyramid_amdjs.amd import build_md5

        m_binit.return_value = '123'
        h = build_md5(self.request, '_')
        self.assertEqual('202cb962ac59075b964b07152d234b70', h)
        self.assertTrue(m_binit.called)
Example #2
0
    def test_build_md5_cached(self, m_binit):
        from pyramid_amdjs.amd import build_md5, ID_AMD_MD5

        self.registry[ID_AMD_MD5]['_'] = '123'

        h = build_md5(self.request, '_')
        self.assertEqual('123', h)
        self.assertFalse(m_binit.called)
Example #3
0
    def test_build_md5(self):
        from pyramid_amdjs.amd import build_md5, ID_AMD_SPEC, RESOLVER

        f = RESOLVER.resolve('pyramid_amdjs:tests/dir/test2.js').abspath()

        reg = self.registry
        reg.settings['amd.enabled'] = True
        reg[ID_AMD_SPEC]['test'] = {'test-init': f}
        reg[ID_AMD_SPEC]['test-init'] = f

        h = build_md5(self.request, 'test')
        self.assertEqual('123', h)